package com.shujia.java.day10.demo2;

public class Cat extends Pet {
    private String sex;

    public Cat() {
    }

    public Cat(String name, int health, String sex) {
        super(name, health);
        this.sex = sex;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    @Override
    public void eat() {
        System.out.println("猫吃鱼");
        System.out.println("健康值+4");
        super.setHealth(super.getHealth()+4);
        System.out.println(getName()+"健康值为:"+super.getHealth());
    }

    @Override
    public void play() {
        System.out.println("狗玩飞盘");
        //玩之后减健康值
        System.out.println("健康值-8");
        super.setHealth(super.getHealth()-8);

        System.out.println(getName()+"健康值为:"+super.getHealth());
    }
}
